#!/bin/bash
## kola:
##   # additionalNics is only supported on QEMU
##   platforms: qemu
##   # Add 2 NIC for this test
##   additionalNics: 2
##   # Configuration of the 2 NICs for this test
##   # We use net.ifnames=0 to disable consistent network naming here because on
##   # different firmwares (BIOS vs UEFI) the NIC names are different.
##   # See https://github.com/coreos/fedora-coreos-tracker/issues/1060
##   appendKernelArgs: "ip=10.10.10.10::10.10.10.1:255.255.255.0:mybridge:br0:none bridge=br0:eth1,eth2 net.ifnames=0"
##   description: Verify bridge networks works via kernel arguments.

set -xeuo pipefail

# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"

bridge="br0"

# Verify "br0" gets ip address by `appendKernelArgs` in `kola` above
nic_ip=$(get_ipv4_for_nic ${bridge})
if [ "${nic_ip}" != "10.10.10.10" ]; then
    fatal "Error: get ${bridge} ip = ${nic_ip}, expected is 10.10.10.10"
fi
ok "get ${bridge} ip is 10.10.10.10"
